package org.example.mapper;

import org.apache.ibatis.annotations.*;
import org.example.pojo.Emp;
import org.example.pojo.EmpQueryParm;
import org.example.pojo.LoginInfo;
import org.example.pojo.PageResult;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    //原始方法
////     查询员工数目
//    @Select("select count(*) from emp left join dept on emp.dept_id = dept.id")
//    public Long count();
//    //分页查询员工信息
//    @Select("select e.* ,d.name deptName  from emp e left join dept d  on e.dept_id = d.id order by" +
//            " e.update_time desc limit #{page},#{size}")
//    public List<Emp> findByPage(Integer page, Integer size);
//新方法

    public List<Emp> findAll(EmpQueryParm empQueryParm);
//    新增员工
    void insert(Emp emp);
    //批量删除
    void deleteByIds(List<Integer> id);
    public Emp findById(Integer id);
//    修改员工
    void update(Emp emp);
    /**
     * 统计员工职位人数
     */
    @MapKey("pos")
    public List<Map<String, Object>> countEmpJobData();

    /**
     * 统计员工性别
     * @return
     */
    @MapKey("name")
    public List<Map<String, Object>> countEmpGenderData();

    /**
     * 登陆 查询
     * @param emp
     * @return
     */
    @Select("select id,name,username  from emp where username = #{username} and password = #{password}")
    Emp selectByUsernameAndPassword(Emp emp);
}
